import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "./assets/style.css";
import "./assets/fonts/iconfont.css";
import axios from 'axios'
// import './plugins/element.js'
// import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import * as echarts from 'echarts';
import TreeTable from 'vue-table-with-tree-grid';
// import VueQuillEditor from 'vue-quill-editor';
axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'
axios.interceptors.request.use((config) => {
  //当进入request拦截器，表示发送了请求，我们就开启进度条
  NProgress.start()
  //为请求头对象，添加token验证的Authorization字段
  config.headers.Authorization = localStorage.getItem('token');
  //必须返回config
  return config
});

//在response拦截器中，隐藏进度条
axios.interceptors.response.use(config => {
  //当进入response拦截器，表示请求已经结束，我们就结束进度条
  NProgress.done()
  return config
})
// import 'quill/dist/quill.core.css';
// import 'quill/dist/quill.snow.css';
// import 'quill/dist/quill.bubble.css';
// Vue.use(ElementUI);


// //导入进度条插件
// import NProgress from 'nprogress'
// //导入进度条样式
// import 'nprogress/nprogress.css'


Vue.prototype.$http = axios;
Vue.config.productionTip = false;
Vue.prototype.$echarts = echarts;
Vue.use(VueQuillEditor);
Vue.component('tree-table', TreeTable);
// 全局过滤器
Vue.filter('dataForm', function (v) {
  // 把时间戳转换为时间格式
  const dt = new Date(v);
  const y = dt.getFullYear(); //年份
  // padStart在指定字符前面加 '0'
  const m = (dt.getMonth() + 1 + "").padStart(2, '0'); //月份
  const d = (dt.getDate() + "").padStart(2, '0');   //日
  const hh = (dt.getHours() + "").padStart(2, '0');   //时
  const mm = (dt.getMinutes() + "").padStart(2, '0');   //分
  const ss = (dt.getSeconds() + "").padStart(2, '0');  //秒

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
